﻿using HardcoreGame.Common.Systems;
using HardcoreGame.Content.Biomes;
using System.Collections.Generic;
using Terraria;
using Terraria.Localization;
using Terraria.ModLoader;

namespace HardcoreGame.Common.GlobalNPCs
{
    public class DialogueNPC : GlobalNPC
    {
        private List<string> chat2 = [];
        private static readonly List<string> textlist = [];
        public override bool InstancePerEntity => true;
        protected override bool CloneNewInstances => true;
        public override void GetChat(NPC npc, ref string chat)
        {
            int num = 6;
            chat2 = GetText(npc, ref num, Main.player[Main.myPlayer]);
            if (Main.rand.Next(num + chat2.Count) > num - 1)
            {
                chat = chat2[Main.rand.Next(chat2.Count)];
            }
        }
        public static List<string> GetText(NPC npc, ref int dialogue, Player player)
        {
            textlist.Clear();
            int type = npc.type;
            if (player.InModBiome<AcidRain>())
            {
                switch (type)
                {
                    case 369:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Angler.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Angler.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Angler.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Angler.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Angler.5"));
                        if(EventSystem.activeEvents.Contains(2))
                        {
                            textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Angler.6"));
                        }                        
                        break;
                    case 19:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.ArmsDealer.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.ArmsDealer.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.ArmsDealer.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.ArmsDealer.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.ArmsDealer.5"));
                        break;
                    case 54:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Clothier.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Clothier.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Clothier.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Clothier.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Clothier.5"));
                        break;
                    case 38:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Demolitionist.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Demolitionist.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Demolitionist.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Demolitionist.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Demolitionist.5"));
                        break;
                    case 20:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Dryad.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Dryad.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Dryad.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Dryad.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Dryad.5"));
                        break;
                    case 207:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.DyeTrader.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.DyeTrader.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.DyeTrader.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.DyeTrader.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.DyeTrader.5"));
                        break;
                    case 107:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.GoblinTinkerer.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.GoblinTinkerer.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.GoblinTinkerer.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.GoblinTinkerer.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.GoblinTinkerer.5"));
                        break;
                    case 588:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Golfer.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Golfer.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Golfer.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Golfer.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Golfer.5"));
                        break;
                    case 22:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Guide.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Guide.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Guide.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Guide.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Guide.5"));
                        break;
                    case 124:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Mechanic.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Mechanic.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Mechanic.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Mechanic.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Mechanic.5"));
                        break;
                    case 17:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Merchant.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Merchant.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Merchant.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Merchant.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Merchant.5"));
                        break;
                    case 18:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Nurse.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Nurse.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Nurse.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Nurse.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Nurse.5"));
                        break;
                    case 227:
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Painter.1"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Painter.2"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Painter.3"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Painter.4"));
                        textlist.Add(Language.GetTextValue("Mods.HardcoreGame.Dialogue.Painter.5"));
                        break;
                }
            }
            return textlist;
        }
    }
}
